	capture log close
	set more off
	//cd -- Change working directory if you don't want to 
	*hardcode in the log and data locations
	


	//  program:	Replication file of standing committee votes. 
	//  task:       replicate results, summer 2019 - ASSOCIATED WITH LSQ R&R 072119
	//	project: 	Standing committee votes
	//  author:     Josh Ryan \ Summer 2019
	// related files: replicationfile_v1_081818, reportvotedat_v6_032319.dta

	// #Start
	// program setup


use "reportvotedat_v6_032319.dta", clear

*Table: OLS Estimates of Bill Characteristics and Chamber Passage Support
	reg  chamyeaper chairorrank mref majority absdwnom percentyea i.stewartcommid i.cong, cluster(stewartcommid)
	estimates store base1
	estat ic
	
	reg chamyeaper chairorrank mref majority absdwnom majpartyvotes i.stewartcommid i.cong, r cluster(stewartcommid)
	estimates store base2
	estat ic
	
	reg chamyeaper chairorrank mref majority absdwnom minpartyvotes i.stewartcommid i.cong, r cluster(stewartcommid)
	estimates store base3
	estat ic
	
	estout base1 base2 base3, style(tex) cells(b(star fmt(2)) se(par)) starlevels($^\#$ .1 * 0.05) stats(aic N) varlabels( ///
	chairorrank	"Chair or Ranking Mem. of Referral Committee" mref "Member of Referral Committee" majority "Sponsor Member of Majority" absdwnom "Sponsor Ideological Extremity" ///
	percentyea "Overall Percentage Voting to Report Bill" majpartyvotes "Majority Percentage to Report" minpartyvotes "Minority Percentage to Report")
	
	

	

	*Table: Bill Characteristics and House Passage
	logit  passh chairorrank mref majority absdwnom percentyea i.stewartcommid i.cong, cluster(stewartcommid)
	estimates store passh1
	estat ic
	logit  passh chairorrank mref majority absdwnom percentyea i.stewartcommid i.cong, cluster(stewartcommid) or
	
	logit passh chairorrank mref majority absdwnom majpartyvotes i.stewartcommid i.cong, cluster(stewartcommid)
	estimates store passh2
	estat ic
	logit passh chairorrank mref majority absdwnom majpartyvotes i.stewartcommid i.cong, cluster(stewartcommid) or
	
	logit passh chairorrank mref majority absdwnom minpartyvotes i.stewartcommid i.cong, cluster(stewartcommid) 
	estimates store passh3	
	estat ic
	logit passh chairorrank mref majority absdwnom minpartyvotes i.stewartcommid i.cong, cluster(stewartcommid) or
	
	logit  passcong chairorrank mref majority absdwnom percentyea i.stewartcommid i.cong, cluster(stewartcommid) 
	estimates store plaw1
	estat ic
	logit  passcong chairorrank mref majority absdwnom percentyea i.stewartcommid i.cong, cluster(stewartcommid) or
	
	logit passcong chairorrank mref majority absdwnom majpartyvotes i.stewartcommid i.cong, cluster(stewartcommid) 
	estimates store plaw2
	estat ic
	logit passcong chairorrank mref majority absdwnom majpartyvotes i.stewartcommid i.cong, cluster(stewartcommid) or
	
	logit passcong chairorrank mref majority absdwnom minpartyvotes i.stewartcommid i.cong, cluster(stewartcommid)
	estimates store plaw3
	estat ic
	logit passcong chairorrank mref majority absdwnom minpartyvotes i.stewartcommid i.cong, cluster(stewartcommid) or
	beep

	estout passh1 passh2 passh3 plaw1 plaw2 plaw3, style(tex) cells(b(star fmt(2)) se(par)) starlevels($^\#$ .1 * 0.05) stats(aic N r2_p) varlabels( ///
	chairorrank	"Chair or Ranking Mem. of Referral Committee" mref "Member of Referral Committee" majority "Sponsor Member of Majority" absdwnom "Sponsor Ideological Extremity" ///
	percentyea "Overall Percentage Voting to Report Bill" majpartyvotes "Majority Percentage to Report" minpartyvotes "Minority Percentage to Report")
	
	
	

*Table: Senate Minority Party Seats and Support on Committee Votes to Report--OLS
reg percentyea chairorrank mref majority absdwnom c.senmajpartyno##i.divcham i.stewartcommid , cluster(stewartcommid)
estimates store comvotes1
estat ic

reg majpartyvotes chairorrank mref majority absdwnom c.smajpartymem##i.divcham i.stewartcommid , cluster(stewartcommid)
estimates store comvotes2
estat ic
 	
reg minpartyvotes chairorrank mref majority absdwnom c.senmajpartyno##i.divcham i.stewartcommid , cluster(stewartcommid)
estimates store comvotes3
estat ic

eststo pp1: margins, at(divcham=(0(1)1) senmajpartyno=(51(1)60)) post vsquish

estout comvotes1 comvotes2 comvotes3, style(tex) cells(b(star fmt(2)) se(par)) starlevels($^\#$ .1 * 0.05) stats(aic N) varlabels( ///
	chairorrank	"Chair or Ranking Mem. of Referral Committee" mref "Member of Referral Committee" majority "Sponsor Member of Majority" absdwnom "Sponsor Ideological Extremity" ///
	percentyea "Overall Percentage Voting to Report Bill" majpartyvotes "Majority Percentage to Report" minpartyvotes "Minority Percentage to Report" ///
	divcham "Divided Govt" c.smajpartymem##i.divcham "House Majority Party Senators x Divided Govt")
	

*Figure: The Conditional Effect of Majority Party Seats During Unified and Divided Party Control of Congress
use "senatemajpartyinteract_v2_072819.dta", clear

*gen interactmerge=99

*merge m:m interactmerge using "C:/Users/A02177653/Dropbox/Committee_votes_data/Research/Data/reportvotedat_v6_032319.dta"

graph twoway (connected predprob seats if divchamindic==0,  sort lcolor(black) lpattern(solid) lwidth(thick) msymbol(none) yaxis(1)) ///
(connected lci seats if divchamindic==0, sort lcolor(gray) lpattern(dash) lwidth(thin) msymbol(none)) ///
(connected uci seats if divchamindic==0, sort lcolor(gray) lpattern(dash) lwidth(thin) msymbol(none)) ///
(connected predprob seats if divchamindic==1,  sort lcolor(black) lpattern(solid) lwidth(thin) msymbol(none) yaxis(1)) ///
(connected lci seats if divchamindic==1, sort lcolor(gray) lpattern(dash) lwidth(thin) msymbol(none)) ///
(connected uci seats if divchamindic==1, sort lcolor(gray) lpattern(dash) lwidth(thin) msymbol(none)), ///
ytitle("Predicted Minority Party Support", axis(1)) xtitle("Number of Senate Majority Party Seats") ///
 ylabel(-10(5)50, axis (1) valuelabel) ///
xlabel(51(1)60, valuelabel) legend(col(1) order(1 "Predicted Minority Support (Unified Control)" 4 "Predicted Minority Support (Divided Control)" 3 "95% Confidence Interval") ///
bplacement(ne) ring(0) size(tiny)) scheme(s1mono) graphregion(fcolor(white) ifcolor(white)) title("")

	
*Figure: Scatter Plot of Minority Party Support with Best Fit Line as a Result of Exogenously Imposed Majority Party Seat Gain
use "partyswitches_v4_032319.dta", clear

twoway (scatter minpartyvotes daysfromtreat if daysfromtreat<0 & daysfromtreat>-30, sort lcolor(black) lpattern(solid) lwidth(thick)) ///
(lfit minpartyvotes daysfromtreat if daysfromtreat<0 & daysfromtreat>-30, lcolor(black) lpattern(solid)) /// 
(scatter minpartyvotes daysfromtreat if daysfromtreat>0 & daysfromtreat<30, sort lcolor(black) lpattern(solid) lwidth(thick)) ///
(lfit minpartyvotes daysfromtreat if daysfromtreat>0 & daysfromtreat<30), ///
ytitle("Percentage of Minority Support") xtitle("Days from Majority Party Seat Gain") ///
 ylabel(0(10)100, valuelabel) ///
xlabel(-30(5)30, valuelabel) ///
xline(0) ///
legend(off) ///
scheme(s1mono) graphregion(fcolor(white) ifcolor(white)) title()



	
*Table: OLS Estimates of Exogenous Senate Party Changes and Minority Support on Committee Votes to Report
use "partyswitches_v4_032319.dta", clear

reg percentyea chairorrank majority mref absdwnom dminseats i.cong i.stewartcommid, cluster(stewartcommid)
estimates store switch1
	
reg majpartyvotes chairorrank majority mref absdwnom dminseats i.cong i.stewartcommid, cluster(stewartcommid)
estimates store switch2
	
reg minpartyvotes chairorrank majority mref absdwnom c.dminseats i.cong i.stewartcommid, cluster(stewartcommid) level(90)
estimates store switch3
	
estout switch1 switch2 switch3, style(tex) cells(b(star fmt(2)) se(par)) starlevels($^\#$ .1 * 0.05) stats(aic N r2) varlabels(chairorrank	"Member of Referral Committee" mref "Multiple Referral" ///
majority "Sponsor Member of Majority" absdwnom "Ideological Extremity" dminseats "Number of Senate Majority Party Members")

	


	
	
	

